Create a mock ArgumentsHost as a plain object cast to the interface and call catch() directly — no HTTP server required. Use Test.createTestingModule() to resolve the filter with its injected dependencies. Assert that res.status() and res.json() were called with the expected arguments.
Call catch() directly — no need to spin up an HTTP server for unit tests.
Create the mock host as a plain object cast to ArgumentsHost using as unknown as ArgumentsHost.
Mock switchToHttp() to return mock getResponse() and getRequest() functions.
Use jest.fn().mockReturnValue() chaining to simulate res.status(n).json(body) fluent API.
Test both HttpException branches and non-HttpException (unexpected error) branches separately.